{extend name="public:layout" /}
{block name="title"}编辑部门{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> <a href="{:url('index')}"> 部门列表</a></li>
                <li class="active">编辑部门</li>
            </ol>
        </div>
        <div class="ibox-content">
            <form method="post" class="form-horizontal" id="form">
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">上级部门</label>
                    <div class="col-sm-3">
                        <select name="dept_fid" class="form-control">
                            <option value="0">===顶级部门===</option>
                            {volist name="dept" id="vo"}
                            <option value="{$vo.dept_id}" {$vo.selected} {$vo.disabled}>
                                {$vo._name}
                            </option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">部门名称</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control one" placeholder="请输入部门名称"
                               name="dept_name" data-type="*" value="{$info.dept_name}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">部门描述</label>
                    <div class="col-sm-8">
                        <input type="text" class="form-control one" placeholder="请输入部门描述"
                               name="dept_code" value="{$info.dept_code}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">部门负责人</label>
                    <div class="col-sm-4">
                        {:widget('common/Form/selectpage',['dept_uid',$info['dept_uid'], 'keyField:uid|showField:username|multiple:false|dbTable:user|formatfun:formatUser'])}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label Validform_label">部门排序</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control"
                               name="dept_sort" value="{$info.dept_sort}" datatype="n" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <button class="btn btn-primary" type="button" id="btnSub">
                            保存内容
                        </button>
                        <a href="{:url('index')}" class="btn btn-white">取消</a>
                        <span id="validError"></span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function () {
        ajaxSubForm('#btnSub');
    })
	function formatUser(res) {
        return res.name+'['+res.mobile+']';
    }
</script>
{/block}